from django.urls import re_path
from rest_framework.routers import SimpleRouter
from plumes import views
urlpatterns = [
    re_path(r'^channels/$', views.ChannelsViewSet.as_view(
        {
            'get': 'list',
        }
    )),
    re_path(r'^articles/search/$', views.ArticleSearchView.as_view(
        {
            'get': 'list'
        }
    )),
    re_path(r'^article/(?P<pk>\d+)/collect/$', views.CollectSView.as_view()),

    re_path(r'^article/$', views.PublishArticleView.as_view(
        {
            'post': 'create',
        }
    )),
    re_path(r'^article/(?P<pk>\d+)/publish_comment/$', views.PublishCommentView.as_view(
        {
            'post': 'create',
        }
    )),
    re_path(r'^article/(?P<pk>\d+)/$', views.ArticleInfoViewSet.as_view(
        {
            'get': 'retrieve',
        }
    )),
]


router = SimpleRouter()
router.register('article/(?P<id>-1|\d+)/channel', views.ChannelListViewSet, basename='文章列表')
urlpatterns += router.urls
